package com.ninth_group.po;


import com.ninth_group.vo.TFHDataVO;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 24小时天气数据
 */
public class TFHData {
    private String cid;
    private int hour;
    private int temp;
    private String windDirection; //  风向
    private int windScale; //  风力等级
    private int aqi; //  AQI: 空气质量指数

    public static TFHData mapRow(ResultSet rs) throws SQLException {
        TFHData TFHData = new TFHData();
        TFHData.setCid(rs.getString("city_id"));
        TFHData.setHour(rs.getInt("hour"));
        TFHData.setTemp(Integer.parseInt(rs.getString("temp")));
        TFHData.setWindDirection(rs.getString("wind_direction"));
        TFHData.setWindScale(rs.getInt("wind_scale"));
        String aqiStr = rs.getString("aqi");
        TFHData.setAqi(TFHDataVO.getIntAqi(aqiStr));
        return TFHData;
    }

    public TFHData() {
    }

    public TFHData(String cid, int hour, int temp,
                   String windDirection, int windScale, int aqi) {
        this.cid = cid;
        this.hour = hour;
        this.temp = temp;
        this.windDirection = windDirection;
        this.windScale = windScale;
        this.aqi = aqi;
    }

    @Override
    public String toString() {
        return "TFHData{" +
                "cid='" + cid + '\'' +
                ", hour=" + hour +
                ", temp=" + temp +
                ", windDirection='" + windDirection + '\'' +
                ", windScale=" + windScale +
                ", aqi='" + aqi + '\'' +
                '}';
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getTemp() {
        return temp;
    }

    public void setTemp(int temp) {
        this.temp = temp;
    }

    public String getWindDirection() {
        return windDirection;
    }

    public void setWindDirection(String windDirection) {
        this.windDirection = windDirection;
    }

    public int getWindScale() {
        return windScale;
    }

    public void setWindScale(int windScale) {
        this.windScale = windScale;
    }

    public int getAqi() {
        return aqi;
    }

    public void setAqi(int aqi) {
        this.aqi = aqi;
    }
}
